name: "Tests and Docs"

on:
  push:
    branches: [ "main" ]
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        emacs_version:
          - 24.3
          - 24.4
          - 24.5
          - 25.1
          - 25.2
          - 25.3
          - 26.1
          - 26.2
          - 26.3
          - 27.1
          - 27.2
          - 28.1
          - 28.2
          - snapshot
      fail-fast: false
    steps:
    - uses: actions/checkout@v3
    - name: Set up Emacs
      uses: purcell/setup-emacs@v4.0
      with:
        version: ${{ matrix.emacs_version }}

    - name: Test
      run: |
        bin/test

    - name: Docs
      run: |
        bin/docs

    - name: Docs Summary
      if: ${{ matrix.emacs_version == 28.2 }}
      run: |
        cat docs.md >> $GITHUB_STEP_SUMMARY
